﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace TrafficSimulation
{
    class TrafficLightPedestrian : TrafficLight 
    {
        public TrafficLightPedestrian(int xPos, int yPos)
        {
            this.width = 20;
            this.length = (this.width) * 3;
            this.color = Color.Red;
            this.xPos = xPos;
            this.yPos = yPos;
        }

        public override void ManageLights(int greenTime)
        {
            //TODO
        }

        public override void paintBulb(Graphics g)
        {
            Pen p = new Pen(Color.White);
            if (this.Color == Color.Red)
            {
                p.Color = this.Color;
                g.DrawEllipse(p, this.xPos + (this.width / 4), this.yPos + (this.width / 4), this.xPos + 3 * (this.width / 4), this.yPos + 3 * (this.width / 4));
                p.Color = Color.White;
                g.DrawEllipse(p, this.xPos + (this.width / 4), this.yPos + 5 * (this.width / 4), this.xPos + 3 * (this.width / 4), this.yPos + 7 * (this.width / 4));
                g.DrawEllipse(p, this.xPos + (this.width / 4), this.yPos + 9 * (this.width / 4), this.xPos + 3 * (this.width / 4), this.yPos + 11 * (this.width / 4));
            }
            else
            {
                p.Color = Color.White;
                g.DrawEllipse(p, this.xPos + (this.width / 4), this.yPos + (this.width / 4), this.xPos + 3 * (this.width / 4), this.yPos + 3 * (this.width / 4));
                g.DrawEllipse(p, this.xPos + (this.width / 4), this.yPos + 5 * (this.width / 4), this.xPos + 3 * (this.width / 4), this.yPos + 7 * (this.width / 4));
                p.Color = this.Color;
                g.DrawEllipse(p, this.xPos + (this.width / 4), this.yPos + 9 * (this.width / 4), this.xPos + 3 * (this.width / 4), this.yPos + 11 * (this.width / 4));
            }
        }

        public override void drawFrame(Graphics g)
        {
            this.paintBulb(g);
        }

        public override void switchColor()
        {
            if (this.Color == Color.Red)
            {
                this.Color = Color.Green;
            }
            else
            {
                this.Color = Color.Red;
            }
        }
    }
}
